package Day009_Map_斗地主_冒泡排序.demo06_集合嵌套;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class d3_Map嵌套Map {
    public static void main(String[] args) {

        //第一个班：
        Map<String, String> map1 = new HashMap<>();
        map1.put("it001", "迪丽热巴");
        map1.put("it002", "古力娜扎");

        //第二个班：
        Map<String, String> map2 = new HashMap<>();
        map2.put("heima001", "蔡徐坤");
        map2.put("heima002", "李易峰");

        //创建Map集合,把Map1 Map2作为值 存入Map集合
        Map<String,Map<String,String>> map = new HashMap<>();
        map.put("传智播客",map1);
        map.put("黑马程序员",map2);
        System.out.println(map.size()); //2个键值对

        //遍历
        //获取map集合中的所有键
        Set<String> keys = map.keySet();
        //遍历所有的键
        for (String key : keys) {
            //根据键找值
            Map<String, String> value = map.get(key);
            //遍历value这个map
            Set<String> keyset = value.keySet();
            for (String s : keyset) {
                String s1 = value.get(s);
                System.out.println(s+s1);
            }
        }

    }
}
